package com.bestcem.xm.qdes.service.impl;

import com.bestcem.xm.qdes.service.QdesLocalCacheService;
import com.github.benmanes.caffeine.cache.Cache;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.function.Function;

/**
 * @ClassName: QdesLocalCacheServiceImpl
 * @Description:
 * @Author: chenglong.yue
 * @Date: 2022/11/30 11:38
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class QdesLocalCacheServiceImpl implements QdesLocalCacheService<String, Object> {
    @Resource(name = "xmQdesCache")
    private final Cache<String, Object> xmQdesCache;


    @Override
    public Object get(@NonNull String key, @NonNull Function<? super String, ?> mappingFunction) {
        return xmQdesCache.get(key, mappingFunction);
    }
}
